﻿
namespace Storm.TextEditor.Parser.Objects
{
    /// <summary>
    /// Represents a more complex TextRange.
    /// </summary>
    public class Segment
    {
        #region Fields

        private int depth = 0;
        private bool expanded = true;

        private Block block = null;
        private Segment parent = null;

        private Row startRow = null;
        private Word startWord = null;
        private Row endRow = null;
        private Word endWord = null;

        private Scope scope = null;

        #endregion

        #region Properties

        /// <summary>
        /// Gets or sets the depth of the Segment.
        /// </summary>
        public int Depth
        {
            get { return depth; }
            set { depth = value; }
        }

        /// <summary>
        /// Gets or sets whether the Segment is expanded.
        /// </summary>
        public bool Expanded
        {
            get { return expanded; }
            set { expanded = value; }
        }

        /// <summary>
        /// Gets or sets the Block of the Segment.
        /// </summary>
        public Block Block
        {
            get { return block; }
            set { block = value; }
        }

        /// <summary>
        /// Gets or sets the parent Segment of the Segment.
        /// </summary>
        public Segment Parent
        {
            get { return parent; }
            set { parent = value; }
        }

        /// <summary>
        /// Gets or sets the starting Row of the Segment.
        /// </summary>
        public Row StartRow
        {
            get { return startRow; }
            set { startRow = value; }
        }

        /// <summary>
        /// Gets or sets the starting Word of the Segment.
        /// </summary>
        public Word StartWord
        {
            get { return startWord; }
            set { startWord = value; }
        }

        /// <summary>
        /// Gets or sets the ending Row of the Segment.
        /// </summary>
        public Row EndRow
        {
            get { return endRow; }
            set { endRow = value; }
        }

        /// <summary>
        /// Gets or sets the ending Word of the Segment.
        /// </summary>
        public Word EndWord
        {
            get { return endWord; }
            set { endWord = value; }
        }

        /// <summary>
        /// Gets or sets the Scope of the Segment.
        /// </summary>
        public Scope Scope
        {
            get { return scope; }
            set { scope = value; }
        }

        #endregion

        /// <summary>
        /// Initializes a new instance of Segment.
        /// </summary>
        public Segment()
        {
        }

        /// <summary>
        /// Initializes a new instance of Segment.
        /// </summary>
        /// <param name="startRow">Starting Row of the Segment.</param>
        public Segment(Row startRow)
        {
            this.startRow = startRow;
        }
    }
}
